package myPackage;
import java.io.File;
import java.io.FilenameFilter;
import java.util.Date;
import java.util.Scanner;


public class FileInfo {
	  public static void main(String args[])
	  {
		  System.out.println("Input path");
		  Scanner vvod=new Scanner(System.in);
	    String dirname;
	    String Mask;
	    String[] dirlist;
	    dirname= vvod.nextLine();
	  
	    System.out.println("Input mask...");
	    Mask= vvod.nextLine();
	    
	    	    
	    File f = new File(dirname);
	    if(!f.exists())  System.out.println("Not exist: " + dirname);
	    
	      else
	      {
	          
			if(Mask == null)
	            dirlist = f.list();   
	          else
	        	    
	           dirlist =  f.list(new MaskFilter(Mask));

	          for (int i = 0; i < dirlist.length; i++)
	          {
	            File f1 = new File(dirname+ File.separator + dirlist[i]);
	            if(!f1.isFile())
	            	  System.out.println("-dir- "+dirlist[i]);
	            }
	          for(int i=0;i<dirlist.length;i++)
	    	  {
	              File f1=new File(dirname+File.separator+dirlist[i]);
	              if(f1.isFile()) {
	                    System.out.println(dirlist[i]+"-->"+"\n \t"+f1.getParent() +"\n \t lastModified: " + new Date(f1.lastModified()));
	              }
	        }
	      }
	  
	}
}
	class MaskFilter 
	implements FilenameFilter
	{
	  String NameMask;
	  MaskFilter(String Mask){
		  NameMask = Mask;
	  };
	  
	  
	  public boolean accept(File dirname, String name)
	  {
	    if(NameMask.equals("*"))
	      return true;

	    return (name.indexOf(NameMask) != -1);
	  }
	}